<template>
    <div class="mine-shopsettle-detail-wrap">
        <van-nav-bar title="线下收款码绑定" left-arrow fixed @click-left="onClickLeft" />
        <div class="business-box" v-for="item, index in voiceList" :key="index">
            <div class="business-box-label" @click="handleAddDevice(item, 0)">
                <div>{{ item.name }}</div>
                <div>二维码号：{{ item.code }}</div>
            </div>
            <!--  disabled-->
        </div>

        <!-- 菜单 -->
        <div class="menu-ul">
            <div @click="handleAddDevice(null, 1)" class="menu-li">
                <!-- <img class="menu-li-icon" src="../../../images/mine/m-s-m-3.png" > -->
                <div class="menu-li-name">添加二维码</div>
                <img class="menu-li-arrow" src="../../../images/mine/icon_jiag.png">
                <!-- <van-icon name="add" /> -->
            </div>
        </div>

    </div>
</template>

<script>
export default {
    data() {
        return {
            id: this.$route.query.id,
            shopInfo: null,
            voiceList: []
        }
    },
    created() {
        localStorage.removeItem('voiceItem')
        this.$http.get(`/store/manage/${this.id}/cashier_code_list`)
            .then(res => {
                this.voiceList = res.data
            })
    },
    methods: {
        onClickLeft() {
            this.$router.back()
        },
        // 添加二维码
        handleAddDevice(item, index) {
            let params = {
                ...item,
                filg: index
            }
            localStorage.setItem('voiceItem', JSON.stringify(params))
            this.$router.push({
                name: 'payDevice',
                query: {
                    id: this.id
                }
            })
        },
    }
}
</script>

<style lang="scss">
.mine-shopsettle-detail-wrap {
    min-height: 100vh;
    padding-top: 58px;
    background-color: #f5f5f5;
    box-sizing: border-box;

    .van-nav-bar .van-icon {
        color: #333333;
    }

    .van-nav-bar__arrow {
        font-size: 20px;
    }

    .shop-info {
        position: relative;
        width: 7.02rem;
        min-height: 2.74rem;
        margin: auto;
        margin-bottom: 0.16rem;
        padding: 0.28rem 0.32rem 0.34rem;
        border-radius: 0.16rem;
        box-sizing: border-box;
        background-color: #FFFFFF;

        .edit-btn {
            position: absolute;
            bottom: 1.12rem;
            right: 0.32rem;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 1.6rem;
            height: 0.52rem;
            border-radius: 0.26rem;
            background: linear-gradient(135deg, #FF5851 0%, #E9011B 100%);

            .edit-text {
                margin-left: 0.24rem;
                font-weight: 400;
                font-size: 0.24rem;
                color: #FFFFFF;
            }

            .edit-arrow {
                width: 0.28rem;
                height: 0.28rem;
            }
        }

        .shop-info-name {
            margin-left: 0.04rem;
            margin-bottom: 0.14rem;
            line-height: 0.4rem;
            font-weight: 500;
            font-size: 0.28rem;
            color: #333333;
        }

        .shop-info-li {
            display: flex;
            margin-bottom: 0.08rem;

            &:last-child {
                margin-bottom: 0;
            }

            .shop-info-li-icon {
                width: 0.32rem;
                height: 0.32rem;
                margin-top: 0.02rem;
                margin-right: 0.12rem;
            }

            .shop-info-li-text {
                font-size: 0.24rem;
                font-weight: 400;
                line-height: 0.36rem;
                color: #666666;
            }
        }
    }

    .business-box {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 7.02rem;
        // height: 0.96rem;
        padding: 0 0.36rem;
        margin: auto;
        margin-bottom: 0.2rem;
        box-sizing: border-box;
        background-color: #FFFFFF;
        border-radius: 0.16rem;

        .business-box-label {
            width: 85%;
            font-weight: 500;
            font-size: 0.28rem;
            color: #333333;
            padding: .2rem 0;
            box-sizing: border-box;

            div:last-child {
                font-family: PingFangSC, PingFang SC;
                font-weight: 400;
                font-size: .24rem;
                color: #666666;
                line-height: .36rem;
                text-align: left;
                font-style: normal;
                margin-top: .1rem;
            }
        }
    }

    .menu-ul {
        width: 7.02rem;
        margin: auto;
        padding: 0.08rem 0;
        background-color: #FFFFFF;
        border-radius: 0.16rem;
        box-sizing: border-box;

        .menu-li {
            position: relative;
            display: flex;
            align-items: center;
            height: 0.8rem;
            padding: 0 0.2rem;
            margin-bottom: 0.16rem;

            &:last-child {
                margin-bottom: 0;
            }

            .menu-li-icon {
                width: 0.48rem;
                height: 0.48rem;
            }

            .menu-li-name {
                margin-left: 0.2rem;
                font-weight: 500;
                font-size: 0.28rem;
                color: #333333;
            }

            .menu-li-arrow {
                position: absolute;
                right: 0.32rem;
                top: 0;
                bottom: 0;
                margin: auto;
                width: 0.32rem;
                height: 0.32rem;
            }
        }
    }

    .income-box {
        width: 7.02rem;
        height: 2.3rem;
        margin: auto;
        margin-bottom: 0.24rem;
        background: url('../../../images/mine/mine-shop-detail-bg.png') no-repeat center;
        background-size: cover;

        .income-total {
            display: flex;
            color: #FFD88B;
            margin-left: 0.36rem;

            .income-total-label {
                height: 0.4rem;
                margin-top: 0.42rem;
                margin-right: 0.08rem;
                line-height: 0.4rem;
                font-size: 0.28rem;
                font-weight: 400;
            }

            .income-total-val {
                height: 0.6rem;
                margin-top: 0.28rem;
                line-height: 0.6rem;
                font-size: 0.44rem;
                font-weight: 600;
            }
        }

        .income-list {
            display: flex;
            justify-content: space-between;
            margin-top: 0.28rem;
            color: #D9D9D9;

            .income-li {
                display: flex;
                align-items: center;
                flex-direction: column;
                flex: 1;

                .income-li-val {
                    height: 0.4rem;
                    margin-bottom: 0.08rem;
                    line-height: 0.4rem;
                    font-size: 0.28rem;
                }

                .income-li-label {
                    height: 0.34rem;
                    line-height: 0.34rem;
                    font-size: 0.24rem;
                }
            }

            .month-income {
                position: relative;

                &::before {
                    position: absolute;
                    left: 0;
                    top: 0;
                    bottom: 0;
                    margin: auto;
                    content: '';
                    width: 0.02rem;
                    height: 0.5rem;
                    background: rgba(255, 255, 255, 0.2);
                }

                &::after {
                    position: absolute;
                    right: 0;
                    top: 0;
                    bottom: 0;
                    margin: auto;
                    content: '';
                    width: 0.02rem;
                    height: 0.5rem;
                    background: rgba(255, 255, 255, 0.2);
                }
            }
        }
    }
}
</style>
